package com.bqtv.sport.adapter

import android.content.Context
import android.graphics.Color
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bqtv.sport.R
import com.bqtv.sport.databinding.ItemPointsMallSignBinding
import com.chad.library.adapter4.BaseQuickAdapter

class PointsMallSignAdapter :
    BaseQuickAdapter<String, PointsMallSignAdapter.VH>() {
    class VH(
        parent: ViewGroup,
        val binding: ItemPointsMallSignBinding = ItemPointsMallSignBinding.inflate(
            LayoutInflater.from(parent.context), parent, false
        ),
    ) : RecyclerView.ViewHolder(binding.root)

    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): VH {
        // 返回一个 ViewHolder
        return VH(parent)
    }

    override fun onBindViewHolder(holder: VH, position: Int, item: String?) {
        // 设置item数据
        holder.binding.llBg.setBackgroundResource(R.drawable.bg_mall_signed)
        holder.binding.llBg.setBackgroundResource(R.drawable.bg_mall_sign)
        holder.binding.tvPoints.setTextColor(Color.parseColor("#2F6146"))
        holder.binding.tvPoints.setTextColor(Color.parseColor("#FF4854"))
        holder.binding.tvSignTime.text = context.getString(R.string.day, position + 1)
    }
}